# problems/__init__.py
from abc import ABC, abstractmethod


class ProblemInstance(ABC):
    """问题实例的抽象基类"""

    @abstractmethod
    def evaluate(self, solution):
        """评估解的代价/适应度"""
        pass

    @abstractmethod
    def get_solution_size(self):
        """获取解的大小/维度"""
        pass

    @abstractmethod
    def get_problem_type(self):
        """获取问题类型标识"""
        pass

    # 可选方法
    def is_feasible(self, solution):
        """检查解的可行性（可选）"""
        return True  # 默认认为所有解都可行

    def get_neighborhood(self, solution, operator_name=None):
        """获取解的邻域（可选，可由算子自己实现）"""
        return []

